package freeboard;

import com.andro.chansung.R;

import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class ContentDialogFragment extends DialogFragment {
	private static ContentDialogFragment cdf;
	
	public static ContentDialogFragment newInstance(String title, String url) {
		cdf = new ContentDialogFragment();
		
		Bundle bundle = new Bundle();
		bundle.putString("title", title);
		bundle.putString("url", url);
		cdf.setArguments(bundle);
		
		return cdf;
	}

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.board_content_dialog_layout, container, false);
		
		getDialog().setTitle(getArguments().getString("title"));
		
		WebView webView = (WebView)view.findViewById(R.id.webView1);
		WebSettings set = webView.getSettings();
		set.setJavaScriptEnabled(true);
		set.setBuiltInZoomControls(true);
		
		webView.loadUrl(getArguments().getString("url"));		
		return view;
	}
}
